package org.jeecg.modules.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.system.entity.ProductionStatusEntity;
import org.jeecg.modules.system.mapper.ProductionStatusMapper;
import org.jeecg.modules.system.service.ProductionStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ProductionStatusServiceImpl implements ProductionStatusService {

    @Autowired
    ProductionStatusMapper mapper;

    /**
     * 查询所有生产状态
     * @param page
     * @param code
     * @param category
     * @return
     */
    @Override
    public IPage<ProductionStatusEntity> getProductionStatusList(Page<ProductionStatusEntity> page, String code, String category) {
        return mapper.getProductionStatusList(page,code,category);
    }

    /**
     * 新增生产状态
     * @param entity
     * @return
     */
    @Override
    public int addProductionStatus(ProductionStatusEntity entity) {

        entity.setCreateTime(new Date());
        return mapper.addProductionStatus(entity);
    }

    /**
     * 删除生产状态
     * @param id
     * @return
     */
    @Override
    public int deleteProductionStatus(int id) {
        return mapper.deleteProductionStatus(id);
    }

    /**
     * 修改状态
     * @param id
     * @param status
     * @return
     */
    @Override
    public int updateProductionStatus(int id, int status) {
        return mapper.updateProductionStatus( id,  status);
    }

    /**
     * 查看详情
     * @param id
     * @return
     */
    @Override
    public ProductionStatusEntity getdetail(int id) {
        return mapper.getdetail(id) ;
    }

    @Override
    public int updateProductionStatusdetail(ProductionStatusEntity entity) {
        return mapper.updateProductionStatusdetail(entity);
    }
}
